package heima.lm.oschina.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import heima.lm.oschina.BaseApplication;
import heima.lm.oschina.R;
import heima.lm.oschina.bean.Comment;

/**
 * Created by 金毛兄弟 on 2017/4/8.
 */

public class TweetDetailAdapter extends BaseRecyclerViewAdapter {


    public TweetDetailAdapter(List list) {
        super(list);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemview = LayoutInflater.from(BaseApplication.mApp).inflate(R.layout.item_tweet_detail, parent, false);
        return new TweetDetailViewHolder(itemview) ;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        TweetDetailViewHolder viewHolder = (TweetDetailViewHolder) holder;
        Comment comment = (Comment) mList.get(position);

        viewHolder.replyText.setText(comment.getContent());//内容
        viewHolder.replyName.setText(comment.getAuthor());//人名
        viewHolder.replyData.setText(comment.getPubDate());//时间

    }

    class TweetDetailViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.reply_icom)
        ImageView replyIcom;
        @BindView(R.id.reply_name)
        TextView replyName;
        @BindView(R.id.reply_data)
        TextView replyData;
        @BindView(R.id.reply_text)
        TextView replyText;
        @BindView(R.id.phone_icom)
        TextView phoneIcom;

        public TweetDetailViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);

        }
    }
}
